<!--
 * @Description: 
 * @Autor: 商晓彬
 * @Date: 2021-08-11 08:50:19
 * @LastEditors: 商晓彬
 * @LastEditTime: 2022-02-16 10:29:26
-->
<div class="procedure">
    <div class="m-subheader">
        <div class="row align-items-center">
            <div class="mr-auto col-auto">
                <h3 class="m-subheader__title m-subheader__title--separator">
                    <span>规程变更管理</span>
                </h3>
            </div>
        </div>
    </div>
    <div class="m-content">
        <div class="m-portlet m-portlet--mobile">
            <div class="m-portlet__body">
                <div class="p-formgroup-inline">
                    <p-button *ngIf="'Pages.ProcedureManagement.ChangeApplication' | permission" label="变更申请" (onClick)="add()"></p-button>
                    <span class="p-field">
                        <span class="input-lable" style="margin-right: 20px;margin-left: 150px;">型号：</span>
                        <input style="line-height: 24px!important;width: 150px;" id="model" type="text" size="30"
                            pInputText [(ngModel)]="model">
                    </span>
                    <span class="p-field">
                        <span class="input-lable" style="margin-right: 20px;margin-left: 20px;">发次：</span>
                        <input style="line-height: 24px!important;width: 150px;" id="senTime" type="text" size="30"
                            pInputText [(ngModel)]="senTime">
                    </span>
                    <span class="p-field">
                        <span class="input-lable" style="margin-right: 20px;margin-left: 20px;">图号：</span>
                        <input style="line-height: 24px!important;width: 150px;" id="lotNum" type="text" size="30"
                            pInputText [(ngModel)]="lotNum">
                    </span>
                    <span class="p-field">
                        <span class="ml input-lable" style="margin-right: 20px;">变更类型：</span>
                        <p-dropdown name="changeType" [options]="changeTypeOptions" [(ngModel)]="changeType"
                            placeholder="请选择变更类型" emptyFilterMessage="暂无数据">
                            <ng-template let-item pTemplate="selectedItem">
                                <span *ngIf="changeType != undefind "
                                    style="vertical-align:middle; margin-left: .5em;width: 147px;">{{item.label}}</span>
                                <span *ngIf="changeType == undefind "
                                    style="vertical-align:middle; margin-left: .5em;width: 147px;"> </span>
                            </ng-template>
                            <ng-template let-model pTemplate="item">
                                <div class="ui-helper-clearfix" style="position: relative;height: 25px;">
                                    <div style="font-size:14px;float:right;margin-top:4px;width: 147px;">{{model.label}}
                                    </div>
                                </div>
                            </ng-template>
                        </p-dropdown>
                    </span>
                    <p-button label="查询" (onClick)="getTableList()" class="ml"></p-button>
                    <p-button label="重置" (onClick)="reset()" class="ml"></p-button>
                    <!-- <i class="pi pi-plus hide" style="font-size: 2em;cursor: pointer;"
                            (click)="tableAdd(record,rowIndex)" data-tips="设计BOM"></i>
                        <i class="pi pi-plus hide" style="font-size: 2em;cursor: pointer;margin-left: 5px;"
                            (click)="tableAdd(record,rowIndex)" data-tips="物料建模"></i> -->
                </div>
                <div class="row align-items-center" style="margin-top: 25px;">
                    <div class="primeng-datatable-container">
                        <p-table #dataTable [value]="primengTableHelper.records" (onLazyLoad)="getTableList($event)"
                            rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
                            [scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
                            [resizableColumns]="primengTableHelper.resizableColumns">
                            <ng-template pTemplate="header">
                                <tr>
                                    <th style="width: 150px">操作</th>
                                    <th style="width: 80px;">序号</th>
                                    <th style="width: 150px">变更编号</th>
                                    <th style="width: 80px">型号</th>
                                    <th style="width: 80px">发次</th>
                                    <th style="width: 150px">规程编号</th>
                                    <th style="width: 150px">名称</th>
                                    <th style="width: 150px">图号</th>
                                    <th style="width: 150px">变更前版本</th>
                                    <th style="width: 150px">变更后版本</th>
                                    <th style="width: 80px">单据状态</th>
                                    <th style="width: 150px">申请人</th>
                                    <th style="width: 150px">申请日期</th>
                                    <!-- <th style="width: 150px">发布日期</th> -->
                                </tr>
                            </ng-template>
                            <ng-template pTemplate="body" let-record="$implicit" let-rowIndex="rowIndex">
                                <tr>
                                    <td style="width: 150px">
                                        <div class="btn-group dropdown" dropdown container="body">
                                            <button dropdownToggle class="dropdown-toggle btn btn-sm btn-primary">
                                                <i class="fa fa-cog"></i><span class="caret"></span> 操作
                                            </button>
                                            <ul class="dropdown-menu" *dropdownMenu>
                                                <li>
                                                    <a *ngIf="'Pages.GeneralManagement.ViewResume' | permission" href="javascript:;" (click)="look(record)">履历</a>
                                                </li>
                                                <li
                                                    [hidden]="record.documentStatus == 1 || record.documentStatus == 3 ">
                                                    <a *ngIf="'Pages.ProcedureManagement.Modify' | permission" href="javascript:;" (click)="UpdateOrLook(record,1)">修改</a>
                                                </li>
                                                <li
                                                    [hidden]="record.documentStatus == 1 || record.documentStatus == 3 ">
                                                    <a *ngIf="'Pages.ProcedureManagement.Delete' | permission" href="javascript:;" (click)="delete(record)">删除</a>
                                                </li>
                                                <li>
                                                    <a *ngIf="'Pages.ProcedureManagement.See' | permission" href="javascript:;" (click)="UpdateOrLook(record,2)">查看</a>
                                                </li>
                                            </ul>
                                        </div>
                                    </td>
                                    <td style="width: 80px;">{{rowIndex+1}}</td>
                                    <td style="width: 150px">{{record.modifyNumber}}</td>
                                    <td style="width: 80px">{{record.model}}</td>
                                    <td style="width: 80px">{{record.lotNo}}</td>
                                    <td style="width: 150px">{{record.techniqueNumber}}</td>
                                    <td style="width: 150px">{{record.modelName}}</td>
                                    <td style="width: 150px">{{record.drawingNo}}</td>
                                    <td style="width: 150px">{{record.reEdition}}</td>
                                    <td style="width: 150px">{{record.lastEdition}}</td>
                                    <td style="width: 80px">{{record.documentStatusDesc}}</td>
                                    <td style="width: 150px">{{record.userName}}</td>
                                    <td style="width: 150px">{{record.applicationDate | momentFormat:'YYYY-MM-DD
                                        HH:mm:ss'}}</td>
                                    <!-- <td style="width: 150px">{{record.lastModificationTime | momentFormat:'YYYY-MM-DD HH:mm:ss'}}</td> -->
                                </tr>
                            </ng-template>
                        </p-table>
                        <div class="primeng-paging-container">
                            <p-paginator [rows]="primengTableHelper.defaultRecordsCountPerPage" #paginator
                                (onPageChange)="getTableList($event)"
                                [totalRecords]="primengTableHelper.totalRecordsCount"
                                [rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
                            </p-paginator>
                            <span class="total-records-count">
                                {{'TotalRecordsCount' | localize:primengTableHelper.totalRecordsCount}}
                            </span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 履历 -->
    <app-prrcedure-show-resume #PrrcedureShowResumeComponent [parentInfo]="rowdata"></app-prrcedure-show-resume>
    <!-- 新增修改查看 -->
    <addOrEddit #addOrEddit [editData]="rowdata" [title]="title" (modalSave)="getTableList()"> </addOrEddit>
</div>